public class Date {
   private int year;
    private int month;
    private int day;

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }

    //构造方法，无返回值，若没有，编译器自动加一个无参数的构造方法
    public Date(){
        this(2024,7,23);//调用其他的带有三个参数的构造方法,只能在第一行
        System.out.println("Date...");
    }
    public Date(int year, int month, int day) {//alt+insert
        this.year = year;//this关键字用表示调用方法时当前对象引用的成员变量
        this.month = month;
        this.day = day;
    }

    public void setDate(int y, int m, int d){
        year=y;
        month=m;
        day=d;

    }

    public void printDate(){
        System.out.println(year+"年"+month+"月"+day+"日");
    }
}
